<?php 
include("includes/code.php");

/////////////////// view_cat uchun
if (isset($_GET['cat'])) {$cat= $_GET['cat']; } if (!isset($cat)) {$cat=1;}

/* menudagi nomni sayt sarlavhasiga joylash uchun olamiz */
$result = mysql_query("SELECT title,parent FROM menu WHERE id='$cat'",$db);
if (!$result)
{ myerror("XATOLIK ! Bazadagi menu jadvalidan malumotlar olinmadi"); }
$myrow = mysql_fetch_array($result);

$parent = $myrow["parent"];
$title = stripslashes($myrow["title"]);

/// podkategoriyaga kirganda uzidan yuqoridagisini kursatamiz
$result_parent = mysql_query("SELECT title FROM menu WHERE id='$parent'",$db);
if(mysql_num_rows($result_parent) > 0)
{
$row_parent = mysql_fetch_array($result_parent);
$title_parent = $row_parent['title']." &nbsp; &gt; &nbsp; ";
}
$title = $title_parent . $title;

///// headerni olamiz
include("includes/header.php"); 
?>

<!-- content and sidebar -->
<div id="main">
<table class="main_table" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td class="left_col">
<!-- ------------- left start ------------- -->
<?php include("includes/left.php"); ?>
    
<!-- ----------------- left finish ---------------- -->
    </td>
    <td>
<div class="content">
<!-- content start -->

<h4 class="sarlavha"><?php echo $title; ?></h4>
<!--tovarlar -->
<?php
///// podkatalog bulsa kursat
$result_child = mysql_query("SELECT id,title FROM menu WHERE parent='$cat'",$db);
if (!$result_child)
{ myerror("XATOLIK ! Bazadagi menu jadvalidan malumotlar olinmadi"); }

if(mysql_num_rows($result_child) > 0)
{
echo "<ul class='showpodcat'>";
	while($row_child = mysql_fetch_array($result_child))
	{
	printf("<li><a href=\"view_cat.php?cat=%s\">%s</a></li>", $row_child["id"], stripslashes($row_child["title"]) );
	}
echo "</ul>";
}

tovarlar("cat");
?>
<div style="clear:both"></div>
<p><a href="all.php"> <?=$lang['all']; ?> &gt;  </a></p>
<!--tovarlar // -->

<!-- content finish -->
</div>
    </td>
    <td class="right_col">
<!-- -------- right start ----------- -->
<?php include("includes/right.php"); ?>
<!-- --------- right finish ------- -->
    </td>
  </tr>
</table>

</div>
<!-- content and sidebar finish -->

</div>
<!-- main container finish -->
<?php include("includes/footer.php"); ?>